<?php 
//$d = new DateTime();
//$d2 = new DateTime("10/18/2011 20:00");
//$t = $d->sub(new DateInterval("P0Y0M0DT0H30M0S"));
//echo $t->format("F j, Y, g:i a");

//$m = new DateTime("10/18/2011 21:05");
//$x = new DateTime();
//$x1 = $x->sub(new DateInterval("P0Y0M0DT0H30M0S"));
//$b = $x1 > $m;
//echo $b;


//get current datetime
$n = new DateTime();
//subtract 30 minutes from current datetime
$x = $n->sub(new DateInterval("P0Y0M0DT0H30M0S"));
//if the session has been modified in the last 30 minutes it is alive

$m = new DateTime("10/20/2011 21:15:03");
//echo $m->format("F j, Y, g:i a");
echo $m->format("d-M-Y h:i A");
?>